function updUserDialog(
    {
        userId,
        phone,
        email,
        userName,
        sex,
        avatarUrl,
        callback = Function()
    }
) {

    if (!userId) {
        return $.toast("用户ID不能为空");
    }

    const $form = $(`
        <form class="mask-account">
            <input type="hidden" name="userId" value="${userId}"/>
            <div style="margin: 0">
                <span class="mask-account-tit">手机号</span>
                <span class="input-select"><input type="text" name="phone"  value="${phone || ''}" placeholder="请输入手机号" /></span>
            </div>
            <div>
                <span class="mask-account-tit">邮箱</span>
                <span class="input-select"><input type="text" name="email"  value="${email || ''}" placeholder="请输入邮箱" /></span>
            </div>
            
            <div>
                <span class="mask-account-tit">用户名</span>
                <span class="input-select"><input type="text" name="userName" value="${userName || ''}" placeholder="请输入用户名" /></span>
            </div>
            
            <div>
                <span class="mask-account-tit">性别</span>
                <span data-select="sex"></span>
            </div>
            
            <div>
                <span class="mask-account-tit">头像</span>
                <div class="input-select" style="border: 0;padding: 0">
                    <input type="hidden" name="avatarUrl">
                </div>
            </div>
       
        </form>
    `)

    const $sexSel = $.getSelect("sex", [
        {name: "请选择", value: ""},
        {name: "男", value: 1},
        {name: "女", value: 2},
    ]);
    $form.find('[data-select="sex"]').replaceWith($sexSel);
    if (sex) {
        $sexSel.find('[data-value="' + sex + '"]').click();
    }

    const $avatarUrlInput = $form.find('input[name="avatarUrl"]');

    $avatarUrlInput.after(getUploadImgWidget({
        maxCount: 1,
        imageUrls: avatarUrl ? [avatarUrl] : [],
        callback(urlList) {
            $avatarUrlInput.val(urlList.join(","))
        }
    }));

    const $dialogWidget = $.dialog($form, {
        title: "编辑用户",
        width: "600px",
        ok: () => {
            const data = $.getFormData($form);

            updUser(data, res => {
                const {Code, Message} = res;
                if (Code !== 10000) {
                    return $.toast(Message);
                }

                $dialogWidget.remove();
                $.toast("编辑成功");
                callback();
            })

            return false;
        }
    })


    function updUser(param, callback = Function()) {
        return $.sApi({
            data: param,
            url: "/api/User/updUser"
        }, callback)
    }

}